package com.xuecheng.media.feignclient.content;

import com.xuecheng.content.model.dto.QueryCourseDetailDto;
import com.xuecheng.content.model.po.CourseBase;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class CourseBaseInfoClientFactory implements FallbackFactory<CourseBaseInfoClient> {
    @Override
    public CourseBaseInfoClient create(Throwable throwable) {
        return new CourseBaseInfoClient() {
            @Override
            public CourseBase getCourseBase(QueryCourseDetailDto dto) {
                log.error("根据条件查询课程基本信息发生熔断:{}",throwable.toString(),throwable);
                return null;
            }
        };
    }
}
